package sk.hackcraft.multibox.server.net;

import sk.hackcraft.multibox.server.MultiBox;
import sk.hackcraft.multibox.server.net.servlet.LibrariesServlet;
import sk.hackcraft.multibox.server.net.servlet.PlaylistServlet;

import java.util.logging.Logger;

public class Server extends sk.nixone.http.Server {
	static public class JsonServerException extends Exception {
		private static final long serialVersionUID = 6508559949194644230L;

		public JsonServerException(Throwable cause) {
			super(cause);
		}
	}

	static final public Logger logger = Logger.getLogger(Server.class.getName());
	
	final public MultiBox box;
	
	public Server(int port, MultiBox box) {
		super(port);
		logger.info("Server created on port "+port);
		this.box = box;
	}

	@Override
	protected void createContexts() {
		http.createContext("/login", new sk.hackcraft.multibox.server.net.TokenServlet(this));
		http.createContext("/path", new LibrariesServlet(this));
		http.createContext("/playlist", new PlaylistServlet(this));
	}
}
